<?php

class My_Plugin_ViewSetup extends Zend_Controller_Plugin_Abstract {
	
	/**
	 *@var Zend_View
	 */
	protected $_view;
	
	public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) {
		
		$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper ( 'viewRenderer' );
		$viewRenderer->init ();
		
		$view = $viewRenderer->view;
		$this->_view = $view;
		
		$prefix = 'My_View_Helper';
		$dir = dirname ( __FILE__ ) . '/../View/Helper';
		$view->addHelperPath ( $dir, $prefix );
		
		//Sets variables that may be required in view
		$view->originalModule = $request->getModuleName ();
		$view->originalControllerName = $request->getControllerName ();
		$view->originalAction = $request->getActionName ();
		
		$view->skin = 'stockheadline';
		
		$view->logo = '<img src="'. $this->_view->baseUrl('/images/logo.gif') . '" height="40px" width="217px" border="0" alt="StockHeadline logo" />';
		
		//sets content type
		$view->headMeta ()->setName ( 'Content-Type', 'text/html;charset=utf-8' );
		
		//include dojo css file
		$view->headLink ()->appendStylesheet ( $this->_view->baseUrl('/css/blueprint/blueprint/screen.css') );
		
		//$view->headScript ()->appendFile ( 'http://www.google.com/jsapi', 'text/javascript' );
		//attach local javascript
		//$view->headScript ()->appendFile ( '', 'text/javascript' );
	
	}
	
//close class
}


